<template>
  <div class="profile">
    <div class="user-info">
      <img src="https://picsum.photos/seed/user/100/100.jpg" alt="用户头像" class="user-avatar">
      <div class="user-details">
        <h3 class="user-name">{{ user.name }}</h3>
        <p class="user-id">学号: {{ user.id }}</p>
      </div>
      <i class="fas fa-chevron-right"></i>
    </div>
    
    <div class="user-stats">
      <div class="stat-item">
        <span class="stat-value">{{ user.stats.activities }}</span>
        <span class="stat-label">参与活动</span>
      </div>
      <div class="stat-item">
        <span class="stat-value">{{ user.stats.hours }}</span>
        <span class="stat-label">服务时长</span>
      </div>
      <div class="stat-item">
        <span class="stat-value">{{ user.stats.badges }}</span>
        <span class="stat-label">获得勋章</span>
      </div>
    </div>
    
    <div class="profile-menu">
      <div class="menu-item">
        <i class="fas fa-calendar-check"></i>
        <span>我的活动</span>
        <i class="fas fa-chevron-right"></i>
      </div>
      <div class="menu-item">
        <i class="fas fa-medal"></i>
        <span>我的勋章</span>
        <i class="fas fa-chevron-right"></i>
      </div>
      <div class="menu-item">
        <i class="fas fa-certificate"></i>
        <span>服务证书</span>
        <i class="fas fa-chevron-right"></i>
      </div>
      <div class="menu-item" @click="goToSettings">
        <i class="fas fa-cog"></i>
        <span>设置</span>
        <i class="fas fa-chevron-right"></i>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Profile',
  data() {
    return {
      // 用户数据可以从API获取
      user: {
        name: '张三',
        id: '20230001',
        avatar: 'https://picsum.photos/seed/user/100/100.jpg',
        stats: {
          activities: 12,
          hours: 36,
          badges: 5
        }
      }
    }
  },
  methods: {
    goToSettings() {
      this.$router.push('/settings')
    }
  }
}
</script>

<style>
.profile {
  padding: 16px;
  padding-bottom: 80px; /* 为底部导航留出空间 */
}

.user-info {
  display: flex;
  align-items: center;
  background-color: #4CAF50;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  color: white;
}

.user-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid white;
  margin-right: 16px;
}

.user-details {
  flex: 1;
}

.user-name {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 4px;
}

.user-id {
  font-size: 14px;
  opacity: 0.8;
}

.user-info i {
  font-size: 20px;
}

.user-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 24px;
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 20px;
  font-weight: bold;
  color: #333;
}

.stat-label {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
}

.profile-menu {
  display: flex;
  flex-direction: column;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.menu-item i:first-child {
  font-size: 20px;
  color: #4CAF50;
  margin-right: 16px;
}

.menu-item span {
  flex: 1;
  font-size: 16px;
  color: #333;
}

.menu-item i:last-child {
  font-size: 14px;
  color: #999;
}

/* 点击效果 */
.menu-item {
  cursor: pointer;
  transition: background-color 0.2s;
}

.menu-item:hover {
  background-color: #f5f5f5;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .profile {
    padding: 12px;
    padding-bottom: 80px;
  }
}
</style>
